#include <vector>
#include <iostream>
#include <string>

using namespace std;

class human
{
    protected:
        string _name;
    public:
        human() 
        {
        };
        ~human()
        {
            cout << _name << endl;
        };
        string getName() {return _name;};
        void setName(string aName) {_name = aName;};
};

class man : public human
{
    public:
        vector<human*> children;

        ~man()
        {
            for(size_t iChild = 0; iChild < children.size(); iChild++)
            {
                if(children[iChild] != 0)
                {
                    delete children[iChild];
                }
            }
        }
};

int main()
{
    vector<man*> daddys;
    man* daddy1 = new man(); daddy1->setName("daddy1");
    human* child1 = new human(); child1->setName("child1");
    daddy1->children.push_back(child1);
    daddys.push_back(daddy1);

    daddys[0]->children[0]->setName("child2");
    daddys[0]->setName("daddy3");

    delete daddy1;

    return 1;
}
